/*
 * @Author: Xavier 1305433186@qq.com
 * @Date: 2023-11-18 19:19:07
 * @LastEditors: Xavier 1305433186@qq.com
 * @LastEditTime: 2023-11-30 15:10:48
 * @FilePath: \KEIL-ARMd:\产品\力量站\JS32T031_SDK\User\task\system_task.c
 * @Description:
 *
 * STAYTRUE (c) 2023 by ${Xavier}, All Rights Reserved.
 */

#include "system_task.h"
#include "main.h"

#if 0
int encoder_value = 0;

void encoder_value_reset(void)
{
    encoder_value = 0;
}
void encoder_value_up(void)
{
    if (encoder_value < 100)
    {
        encoder_value++;
    }
}
void encoder_value_down(void)
{
    if (encoder_value > -100)
    {
        encoder_value--;
    }
}
int get_encoder(void)
{
    return encoder_value;
}
void test_task(void)
{
    key_irq_handle();
    if (encoder_value > 0)
    {
        motor_up(motor_default_duty);
        encoder_value_down();
    }
    else if (encoder_value < 0)
    {
        motor_down(motor_default_duty);
        encoder_value_up();
    }
    else
    {
        motor_brake();
    }
}
#endif
Fitness_System_T Fitness_System;
void set_system_state(char state)
{
    Fitness_System.System_State = state;
}
/*
get_system_state
获取系统状态
*/
char get_system_state(void)
{
    return Fitness_System.System_State;
}
/*
set_display_page
设置系统页面
*/
void set_display_page(char page)
{
    Fitness_System.Display_Page = page;
}
/*
get_display_page
获取系统页面
*/
char get_display_page(void)
{
    return Fitness_System.Display_Page;
}

/*
set_display_state
设置系统状态
*/
void set_display_state(char state)
{
    Fitness_System.Display_State = state;
}
/*
get_display_state
获取系统状态
*/
char get_display_state(void)
{
    return Fitness_System.Display_State;
}

void system_task(void)
{
    switch (get_system_state())
    {
    case Standby: // 待机

        break;
    case System_Start:

        break;
    }
}
